#ifndef HOST_H
#define HOST_H

#include "Common.h"
#include "File.h"

class FileSystem{
private:
    // no private members, really?
    Peer * _peer;

public:
    FileSystem(Peer * peer);
    ~FileSystem();

    int showSystem();

    // file info operations
    bool isFileLocallyPresent(string fileName, int versionNum);
    int requestFile(string fileName, int versionNum);   
    int receivedFile(string fileName, int versionNum);  
    int findFileIndex(string fileName);

    // file system basic operations 
    int modify(string fileName, int versionNum);
    int open(string fileName, int versionNum);
    int close(string fileName, int versionNum);
    int save(string fileName, int versionNum);
    int tag(string fileName, int versionNum);

    // host related operations
    // call this before writing the new tagged file
    int tagHostedFile(string fileName, int versionNum);     // return revision number
    int updateHostedFile(string fileName, int versionNum);  // return revision number
    int addHostFile(string fileName, vector<int> versions, vector<int> revisions);
    int removeHostingInformation();
    bool isFileLocallyHosted(string fileName, int versionNum);

    // disk operations
    int writeFile(string fileName, int versionNum, int chunkNum, bool isFinalChunk);

    // this has to be public in order to populate it at first
    vector<file*> _files;
};

#endif
